//2225.找出输掉零场或一场比赛的玩家
//https://leetcode.cn/problems/find-players-with-zero-or-one-losses
class Solution {
public:
    vector<vector<int>> findWinners(vector<vector<int>>& matches) {
        unordered_map<int,int> victory,fail;
        vector<vector<int>> ret(2);
        for(auto& v:matches)
        {
            ++victory[v[0]];
            ++fail[v[1]];
        }

        for(auto& [k,v]:victory)
            if(fail.count(k) == 0) ret[0].push_back(k);
        
        for(auto& [k,v]:fail)
            if(v == 1) ret[1].push_back(k);

        sort(ret[0].begin(),ret[0].end());
        sort(ret[1].begin(),ret[1].end());

        return ret;
    }
};